package cate.game.role.res.guild.boss.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdGuild;
import cate.game.role.res.guild.po.GuildPO;

import easy.java.practice.errorcode.EcResult;
@ClientMsg(title = "公会boss的数据 の 请求")
public class GuildBossDataReq implements MsgInput {

    @Override
    public MsgConfig conf() {
        return MsgIdGuild.BOSS_DATA_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult r =cc.getRole().getRes().guild.checkGuild();

        if(!r.ok()){
            game.notice.message(cc.getRole(),"用户不存在公会");
            return;
        }
        GuildPO guild = cc.getRole().getRes().guild.getGuild();
        if (guild != null) {
            cc.getRole().sendNow(new GuildBossDataResp(guild.boss));
        }
    }
}
